<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">


    <title>{$site.name|htmlentities}</title>
    <link rel="shortcut icon" href="__CDN__/assets/img/favicon.ico" />

    <link rel="stylesheet" href="__CDN__/template/yuyue/assets/plugins/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="__CDN__/template/yuyue/assets/plugins/jvectormap/jquery-jvectormap-2.0.3.css" />
    <link rel="stylesheet" href="__CDN__/template/yuyue/assets/plugins/morrisjs/morris.css" />
    <!-- Custom Css -->
    <link rel="stylesheet" href="__CDN__/template/yuyue/assets/css/main.css">
    <link rel="stylesheet" href="__CDN__/template/yuyue/assets/css/blog.css">
    <link rel="stylesheet" href="__CDN__/template/yuyue/assets/css/color_skins.css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --><!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script><![endif]-->

</head>

<body class="theme-black">
<div class="page-loader-wrapper" style="display: none;">
    <div class="loader">
        <div class="m-t-30">
            <img src="__CDN__/template/yuyue/assets/images/logo.svg" width="48" height="48" alt="{$site.name|htmlentities}">
        </div>
        <p>Please wait...</p>
    </div>
</div>
<nav class="navbar">
    <div class="container">
        <ul class="nav navbar-nav">
            <li>
                <div class="navbar-header" style=" padding-top: 10px; ">
                    <a class="navbar-brand" href="checkIn">
                        <img src="__CDN__/template/yuyue/assets/images/logo-black.svg" width="35" alt="{$site.name|htmlentities}">
                        <span class="m-l-10">{$site.name|htmlentities}</span>
                    </a>
                </div>
            </li>
            <li class="float-right">
                <a href="user" role="button">
                    <i class="zmdi zmdi-account-circle"></i>
                </a>
            </li>
        </ul>
    </div>
    <div style="clear: both"></div>
</nav>
<section class="content invoice">

    <div class="container">
        <div class="block-header">
            <div class="row clearfix">
                <div class="col-lg-5 col-md-5 col-sm-12">
                    <h2>我的预约</h2>
                </div>
                <div class="col-lg-7 col-md-7 col-sm-12">
                    <ul class="breadcrumb float-md-right padding-0">
                        <li class="breadcrumb-item">
                            <a href="checkIn">
                                <i class="zmdi zmdi-notifications"></i>
                            </a>
                        </li>
                        <li class="breadcrumb-item active">如果预约成功，但因为各种原因不能住院，请及时取消哦～</li>
                    </ul>
                </div>
            </div>
        </div>
        <!--
            <div class="check-date m-b-15 font-18">
                我的预约
                <span style="float:right;color: #838383;" class="font-16 logout">退出登录</span>
            </div>
        -->
        <div class="row clearfix">
            <div class="col-lg-12">

                {foreach $list as $vo}
                <div class="card" id="details">
                    <div class="body">
                        <div class="row">
                            <div class="col-md-6 col-sm-6">
                                <address>
                                    <strong>首都儿科研究所</strong>
                                    <br>
                                    风湿免疫科2病区
                                    <br>
                                    北京市朝阳区雅宝路2号
                                    <br>
                                    <span title="Phone" style="text-decoration: underline dotted">护士站电话</span>: (010) 8569 5670
                                </address>
                            </div>
                            <div class="col-md-6 col-sm-6 text-right">
                                <p class="m-b-0">
                                    <strong>提交日期:</strong>
                                    {$vo.create_time}
                                </p>

                                {if condition="$vo.status == 0"}
                                <span class="revoke btn btn-danger btn-round" style="float:right;color:#fff;" data-id="{$vo.id}">撤销申请</span>
                                {/if}


                                {if condition="$vo.status == 1 && $vo.order.order_status === 0"}
                                <span class="cancel btn btn-danger btn-round" style="float:right;color:#fff;"
                                      data-oid="{$vo.order.id}" data-id="{$vo.id}" data-date="{$vo.stay_date}">取消预约</span>
                                {/if}

                                {if condition="$vo.status == 2"}
                                <span class="" style="float:right;color:red;">{$vo.reject_reason}</span>
                                {/if}
                            </div>
                        </div>
                        <div class="mt-40"></div>
                        <div class="row">
                            <div class="col-md-12">
                                <div class="table-responsive">
                                    <table class="table table-striped">
                                        <thead>
                                        <tr>
                                            <th>住院姓名</th>
                                            <th>预约住院日期</th>
                                            <th>审核结果</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <tr>

                                            <td>{$vo.patient_name}</td>
                                            <td>{$vo.stay_date}</td>

                                            <td>
                                                {if condition="$vo.status == 0"}
                                                <span class="badge badge-default">审核中</span>
                                                {elseif condition="$vo.status == 1"}
                                                <span class="badge badge-success">已通过</span>
                                                {elseif condition="$vo.status == 2"}
                                                <span class="badge badge-default">未通过</span>
                                                {elseif condition="$vo.status == 3"/}
                                                <span class="badge badge-default">申请已撤销</span>
                                                {else}
                                                <span class="badge badge-default">预约已取消</span>
                                                {/if}

                                            </td>
                                        </tr>

                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                {/foreach}
                <div class="index-gallery">
                    <a href="checkIn">
                        <button type="button" class="btn btn-raised  btn-round waves-effect m-b-20" style="width: 100%;background: #6e99ff;">
                            再次预约
                        </button>
                    </a>
                    <button type="button" class="btn btn-raised btn-primary btn-round waves-effect m-b-20 logout" style="width: 100%;background: #dee2e6;">
                        退出账号
                    </button>
                </div>
            </div>


        </div>
    </div>
</section>

</body>

<script src="__CDN__/assets/libs/jquery/dist/jquery.min.js"></script>
<script src="__CDN__/assets/libs/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="__CDN__/assets/libs/fastadmin-layer/dist/layer.js"></script>
<script>
    $(function () {
        $(document).on('click', '.revoke', function () {
            let that = $(this);
            layer.confirm('您确认撤销此次申请吗？', {
                title: null,
                btn  : ['确认', '取消'] //按钮
            }, function () {
                $.post('revoke', {id: that.data('id')}, function (res) {
                    if (res.code !== 1) {
                        return layer.msg(res.msg);
                    }
                    layer.msg(res.msg, function () {
                        location.reload();
                    })
                });
            });
        })

        $(document).on('click', '.cancel', function () {
            let that = $(this);
            layer.confirm('当前预约申请已通过，您确认取消吗？', {
                title: null,
                btn  : ['确认', '取消'] //按钮
            }, function () {
                $.post('cancelOrder', {oid: that.data('oid'), id: that.data('id'), date: that.data('date')}, function (res) {
                    if (res.code !== 1) {
                        return layer.msg(res.msg);
                    }
                    layer.msg(res.msg, function () {
                        location.reload();
                    })
                });
            });
        })
        $('.logout').click(function () {
            $.post('logout', {}, function (res) {
                if (res.code !== 1) {
                    return layer.msg('退出失败');
                }
                // localStorage.removeItem('token');
                location.href = 'index';
            });
        })
    });
</script>
</html>
